<#include "/common/layout.html">
<@body>
<div class="content">
	<form role="form" class="form-horizontal" method="post" action="/system/dept/doEdit" id="editDeptForm">
		<div class="box-body">
			<input type="hidden" value="${(dept.deptId)}" id="deptId" name="deptId" />
			<div class="form-group">
				<label for="deptName" class="col-sm-2 control-label">部门名称</label>
				<div class="col-sm-10">
					<input type="text" id="deptName" name="deptName" class="form-control" value="${(dept.deptName)!}" placeholder="请输入部门名称" required>
				</div>
			</div>
			<div class="form-group">
				<label for="deptDesc" class="col-sm-2 control-label">部门描述</label>
				<div class="col-sm-10">
					<textarea class="form-control" name="deptDesc" rows="3" placeholder="请输入描述，最多300个字符 ..." required>${(dept.deptDesc)!}</textarea>
				</div>
			</div>
		</div>
	</form>
</div>
</@body>
<script type="text/javascript">
	function submitHandler() {
		if ($("#editDeptForm").validate().form()) {
			var formData = $("#editDeptForm").serialize();
			var index = layer.load(3); // 换了种风格
			$.ajax({
				url : $("#editDeptForm").attr('action'),
				type : 'POST',
				dataType : "json",
				data : formData,
				beforeSend : function() {
					$.modal.loading("正在处理中，请稍后...");
					$.modal.disable();
				},
				success : function(data) {
					layer.close(index);
					if (data.code == 200) {
						if (data.msg) {
							parent.layer.msg(data.msg, {
								icon : 1
							});
						} else {
							parent.layer.msg('提交成功', {
								icon : 1
							});
						}
						parent.layer.closeAll('iframe'); // 关闭当前frame
						window.parent.data_oTable.draw(false);
					} else {
						layer.msg(data.msg, {
							icon : 2
						});
						$.modal.closeLoading();
						$.modal.enable();
					}
				}
			});
		}
	}
</script>